package com.example.demofdfs.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test {

	public static void main(String[] args) {
		String s = "/tmp/ansible1543975794080.sh: line 1: kill: xxx: arguments must be process or job IDsnon-zero return code";
		String p2 = "^/tmp/ansible[0-9]{0,}.sh.*";
		System.out.println(s.matches(p2));
		System.out.println(matches(p2, s));
	}
	
    public static boolean matches(String regex) {
       return matches(regex, regex);
    }
	
    public static boolean matches(String regex, CharSequence input) {
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(input);
        return m.matches();
    }
}
